﻿using System;
using System.Windows.Media;

namespace FKRP.WP7.Library
{
    public class Common
    {
        public static Color ParseColor(string color)
        {
            color = color.TrimStart('#');
            var alpha = byte.Parse(color.Substring(0, 2), System.Globalization.NumberStyles.HexNumber);
            var r = byte.Parse(color.Substring(2, 2), System.Globalization.NumberStyles.HexNumber);
            var g = byte.Parse(color.Substring(4, 2), System.Globalization.NumberStyles.HexNumber);
            var b = byte.Parse(color.Substring(6, 2), System.Globalization.NumberStyles.HexNumber);
            return Color.FromArgb(alpha, r, g, b);
        }

    }
}
